package nd.privatebrowser;

import net.htmlparser.jericho.Renderer;
import net.htmlparser.jericho.Segment;
import net.htmlparser.jericho.Source;
import net.htmlparser.jericho.StartTag;


public class TextRenderer extends Renderer {
	
	public TextRenderer(String html) {
		this(new Source(html));
	}
	
	
	public TextRenderer(Segment segment) {
		super(segment);			
	}

	@Override
	public String renderHyperlinkURL(StartTag startTag) {
		String href=startTag.getAttributeValue("href");
		String tag = startTag.getName();
        if (href==null || href.equals("#") || href.startsWith("javascript:")) return null;
        return "<"+tag+" href=\""+href+"\">"+href+"</"+tag+">";
	}

	@Override
	public String getNewLine() {
		return "<br/>";
	}

}   